<template>
</template>

<script>
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { encrypt } from '@/utils/jsencrypt'
export default {
  name: 'LoginPath',
  data () {
    return {
      loginForm: {
        username: 'admin',
        password: 'TjAdmin23@..',
        rememberMe: false,
        freeLogin: false,
        code: '',
        uuid: ''
      }
    }
  },
  mounted(){
    this.login();
  },
  methods:{
    login(){
      let that = this;
      // this.$store.dispatch('Login', this.loginForm).then(() => {
      //   setTimeout(()=>{
      //     that.$router.push({ path: '/' }).catch(() => { })
      //   },500)

      // })
      login(this.loginForm.username, 
        encrypt(this.loginForm.password), 
        this.loginForm.code, 
        this.loginForm.uuid).then(res => {
        setToken(res.data.token);
        setTimeout(()=>{
          that.$router.push({ path: '/' }).catch(() => { })
        },500)
      })
    }
  },
}
</script>

<style>
</style>
